TROUBLESHOOT HELP PAGE
Owner: Zarin DEADLINE: Jan. 14
3-6 Setences explaning each situation with example.
10+ errors explained
I have completed and finalized the this page: Here is the dropbox link: http://dl.dropbox.com/u/12300825/Trouble%20%20Shooting%20Help%20Page.docx
You did an amazing job, Zarin! I just skimmed through it, but everything looks fine so far. The introduction sounds a little wonky, so I'll provide a possible alternative here, as well. Moreover, you might want to have the Error Message as the heading. So:
ERROR MESSAGE: Syntax Error at End of File. Expected 'end if' Example code var number: int number := 3 if number > 0 then put "Three is greater than zero." else
put "Three is smaller than zero."
Solution BLAH BLAH BLAH
It's just an suggestion, though. As for the introduction, I'll write an alternative later tonight (hopefully) and post it up. One more thing: "Troubleshooting" is one word. :) Again, great job! - Pearl
Sample intro:
Now that you know more about Turing selection, you must apply that knowledge to your programs. It is not uncommon to make mistakes when trying new things. Therefore, we have provided possible errors you may come across and their solutions. Each error is bolded, and is followed by a sample code, and finally the solution. Please note that your code may not look exactly like the examples provided; however, the solution will remain the same.
CONTRIBUTE HERE!!!!
(Post code with error here and explanation of how to solve. Zarin will elaborate.)
EXAMPLE ONE:
var number: int
number := 3
if number > 0 then
put "Three is greater than zero."
else
put "Three is smaller than zero."
ERROR MESSAGE: Syntax error at 'End of File'. expected 'end if'
The structure is not complete. This will also happen if you do not put "end case" at the end of a case statement.
In essence, remember to end your if and case statements!
EXAMPLE TWO:
var integer : int
put "Integer? " ..
get integer
if integer = 'a' then
put integer
end if
ERROR MESSAGE: Operands of comparison operators must be of the same type
The operands ("integer" and "'a'") must be of the same type. Integer is an integer while 'a' is a character.
Of course, this error message comes at ANY TIME the operands aren't of the same type. For example: integer and real, real and string, character and string, etc.
EXAMPLE THREE:
var integer1 : int
var integer2 : int
put "Integer? " ..
get integer1, integer2
case integer of
label 1 :
put integer1
label :
put integer2
end case
ERROR MESSAGE: 'integer' has not been declared
The control value must be declared. If it is not declared, then the computer will not be able to find this storage space.
EXAMPLE FOUR:
var integer : real
put "Integer? " ..
get integer
case integer of
label 1 :
put integer
label :
put integer + 1
end case
ERROR MESSAGE: Bad type for case expression
A control value must be an integer or character variable. There are instances in which the control value is a constant, but it is not seen as often.
EXMAPLE FIVE:
var integer1 : int
var integer2 : int
put "Integer? " ..
get integer1
if integer1 = 1 then
put integer1
elsif integer1 not= 1 then put integer2
end if
ERROR MESSAGE: Variable has not been declared
There is nothing in the "storage space" in the variable 'integer2'. You must assign a variable by one of two options. EXAMPLE SIX:
var x : int
x := 9
case x of
label x > 8:
put x
label 8:
put x + 1
end case
ERROR MESSAGE: Compile time expression expected.
EXAMPLE SEVEN: EXAMPLE EIGHT: EXAMPLE NINE: EXAMPLE TEN: EXMAPLE ELEVEN: EXAMPLE TWELVE: EXAMPLE THIRTEEN: EXMAPLE FOURTEEN: EXAMPLE FIFTEEN:
Owner: Zarin
DEADLINE: Jan. 14
- 3-6 Setences explaning each situation with example.
- 10+ errors explained
I have completed and finalized the this page: Here is the dropbox link:http://dl.dropbox.com/u/12300825/Trouble%20%20Shooting%20Help%20Page.docx
You did an amazing job, Zarin! I just skimmed through it, but everything looks fine so far. The introduction sounds a little wonky, so I'll provide a possible alternative here, as well. Moreover, you might want to have the Error Message as the heading. So:
ERROR MESSAGE: Syntax Error at End of File. Expected 'end if'
Example code
var number: int
number := 3
if number > 0 then
put "Three is greater than zero."
else
put "Three is smaller than zero."
Solution
BLAH BLAH BLAH
It's just an suggestion, though. As for the introduction, I'll write an alternative later tonight (hopefully) and post it up.
One more thing: "Troubleshooting" is one word. :)
Again, great job!
- Pearl
Sample intro:
Now that you know more about Turing selection, you must apply that knowledge to your programs. It is not uncommon to make mistakes when trying new things. Therefore, we have provided possible errors you may come across and their solutions. Each error is bolded, and is followed by a sample code, and finally the solution. Please note that your code may not look exactly like the examples provided; however, the solution will remain the same.
CONTRIBUTE HERE!!!!
(Post code with error here and explanation of how to solve. Zarin will elaborate.)EXAMPLE ONE:
var number: int
number := 3
if number > 0 then
put "Three is greater than zero."
else
put "Three is smaller than zero."
ERROR MESSAGE: Syntax error at 'End of File'. expected 'end if'
The structure is not complete. This will also happen if you do not put "end case" at the end of a case statement.
In essence, remember to end your if and case statements!
EXAMPLE TWO:
var integer : int
put "Integer? " ..
get integer
if integer = 'a' then
put integer
end if
ERROR MESSAGE: Operands of comparison operators must be of the same type
The operands ("integer" and "'a'") must be of the same type. Integer is an integer while 'a' is a character.
Of course, this error message comes at ANY TIME the operands aren't of the same type. For example: integer and real, real and string, character and string, etc.
EXAMPLE THREE:
var integer1 : int
var integer2 : int
put "Integer? " ..
get integer1, integer2
case integer of
label 1 :
put integer1
label :
put integer2
end case
ERROR MESSAGE: 'integer' has not been declared
The control value must be declared. If it is not declared, then the computer will not be able to find this storage space.
EXAMPLE FOUR:
var integer : real
put "Integer? " ..
get integer
case integer of
label 1 :
put integer
label :
put integer + 1
end case
ERROR MESSAGE: Bad type for case expression
A control value must be an integer or character variable. There are instances in which the control value is a constant, but it is not seen as often.
EXMAPLE FIVE:
var integer1 : int
var integer2 : int
put "Integer? " ..
get integer1
if integer1 = 1 then
put integer1
elsif integer1 not= 1 then
put integer2
end if
ERROR MESSAGE: Variable has not been declared
There is nothing in the "storage space" in the variable 'integer2'. You must assign a variable by one of two options.
EXAMPLE SIX:
var x : int
x := 9
case x of
label x > 8:
put x
label 8:
put x + 1
end case
ERROR MESSAGE: Compile time expression expected.
EXAMPLE SEVEN:
EXAMPLE EIGHT:
EXAMPLE NINE:
EXAMPLE TEN:
EXMAPLE ELEVEN:
EXAMPLE TWELVE:
EXAMPLE THIRTEEN:
EXMAPLE FOURTEEN:
EXAMPLE FIFTEEN: